﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using SCB.Presentation.Models;

namespace SCB.Presentation.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            HomeModels models = new HomeModels
                                    {
                                        Categories = CategoryService.LeftPanelData,
                                        MostProviderProducts = ProductService.AllProducts.Take(10),
                                        NewChangePriceProducts =
                                            ProductService.AllProducts.OrderBy(p => p.Price).Take(10),
                                        NewUpdateProducts =
                                            ProductService.AllProducts.OrderByDescending(p => p.CreateDate).Take(10),
                                        OneMonthProducts =
                                            ProductService.AllProducts.OrderByDescending(p => p.CreateDate).Take(10),
                                        OneWeekProducts =
                                            ProductService.AllProducts.OrderByDescending(p => p.CreateDate).Take(10),
                                        ProviderLocations = ProviderService.GetProviderAllLocations()
                                    };


            return View(models);
        }

        public ActionResult About()
        {
            return View();
        }
    }
}
